import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
    {
        path: "/", //账户
        component: (resolve) => require(['@/views/Account/index.vue'], resolve),
        meta: {
            title: '账户'
        }
    },
    {
        path: "/account/home",
        component: (resolve) => require(['@/views/Account/index.vue'], resolve),
        meta: {
            title: '账户首页'
        }
    },
    {
        path: "/account/passwordGetBack",
        component: (resolve) => require(['@/views/Account/passwordGetBack.vue'], resolve),
        meta: {
            title: '找回密码'
        }
    },
    {
        path: "/account/passwordGetBackSuccess",
        component: (resolve) => require(['@/views/Account/passwordGetBackSuccess.vue'], resolve),
        meta: {
            title: '找回密码成功'
        }
    },
    {
        path: "/account/passwordUpdate",
        component: (resolve) => require(['@/views/Account/passwordUpdate.vue'], resolve),
        meta: {
            title: '更改密码'
        }
    },
    {
        path: "/account/passwordUpdateSuccess",
        component: (resolve) => require(['@/views/Account/passwordUpdateSuccess.vue'], resolve),
        meta: {
            title: '更改密码成功'
        }
    },
    {
        path: "/account/phoneBinding",
        component: (resolve) => require(['@/views/Account/phoneBinding.vue'], resolve),
        meta: {
            title: '手机号码绑定设置'
        }
    },
    {
        path: "/account/phoneUpdate",
        component: (resolve) => require(['@/views/Account/phoneUpdate.vue'], resolve),
        meta: {
            title: '手机号码换绑'
        }
    },
    {
        path: "/account/phoneBindSuccess",
        component: (resolve) => require(['@/views/Account/phoneBindSuccess.vue'], resolve),
        meta: {
            title: '手机号码设置完成'
        }
    },
    {
        path: "/account/identifyBinding",
        component: (resolve) => require(['@/views/Account/identifyBinding.vue'], resolve),
        meta: {
            title: '身份证绑定'
        }
    },
    {
        path: "/account/identifyBindSuccess",
        component: (resolve) => require(['@/views/Account/identifyBindSuccess.vue'], resolve),
        meta: {
            title: '身份证绑定完成'
        }
    },
    {
        path: "/pay/gameMain",
        component: (resolve) => require(['@/views/GamePay/index.vue'], resolve),
        meta: {
            title: '游戏充值页面'
        }
    },
    {
        path: "/pay/smView",
        component: (resolve) => require(['@/views/GamePay/smPay.vue'], resolve),
        meta: {
            title: '扫码支付页面'
        }
    },
    {
        path: "/pay/gameBack",
        component: (resolve) => require(['@/views/GamePay/callBack.vue'], resolve),
        meta: {
            title: '游戏充值成功页面'
        }
    },
    {
        path: "/pay/platformCoin",
        component: (resolve) => require(['@/views/Finance/platformCoinPay.vue'], resolve),
        meta: {
            title: '平台币充值页面'
        }
    },
    {
        path: "/pay/platformCoinBack",
        component: (resolve) => require(['@/views/Finance/platformCoinCallBak.vue'], resolve),
        meta: {
            title: '平台币成功成功'
        }
    },
    {
        path: "/pay/sqkMain",
        component: (resolve) => require(['@/views/SqkPay/sqkPayMain.vue'], resolve),
        meta: {
            title: '省钱卡购买页面'
        }
    },
    {
        path: "/pay/PayCallBack",
        component: (resolve) => require(['@/views/SqkPay/PayCallBack.vue'], resolve),
        meta: {
            title: '省钱卡购买成功跳转页面'
        }
    },
    {
        path: "/KeFu/main",
        component: (resolve) => require(['@/views/KeFu/index.vue'], resolve),
        meta: {
            title: '客服页面'
        }
    },
    {
        path: "/KeFu/faqDetails",
        component: (resolve) => require(['@/views/KeFu/faqDetails.vue'], resolve),
        meta: {
            title: '客服页面'
        }
    },


    {
        path: "/finance/cashOutMoney",
        component: (resolve) => require(['@/views/Finance/cashOutMoney.vue'], resolve),
        meta: {
            title: '现金余额提现'
        }
    },
    {
        path: "/gift/list",
        component: (resolve) => require(['@/views/Welfare/Gift/index.vue'], resolve),
        meta: {
            title: '礼包列表'
        }
    },
    {
        path: "/coupon/list",
        component: (resolve) => require(['@/views/Welfare/Coupon/index.vue'], resolve),
        meta: {
            title: '优惠券列表'
        }
    },
    {
        path: "/coupon/myList",
        component: (resolve) => require(['@/views/Welfare/Coupon/myCoupon.vue'], resolve),
        meta: {
            title: '我的优惠券列表'
        }
    },
    {
        path: "/activities/list",
        component: (resolve) => require(['@/views/Welfare/Activities/index.vue'], resolve),
        meta: {
            title: '游戏活动列表'
        }
    },
    {
        path: "/activities/details",
        component: (resolve) => require(['@/views/Welfare/Activities/details.vue'], resolve),
        meta: {
            title: '游戏活动详情'
        }
    },
    {
        path: "/redPacket/list",
        component: (resolve) => require(['@/views/RedPacket/index.vue'], resolve),
        meta: {
            title: '红包列表'
        }
    },
    {
        path: "/redPacket/details",
        component: (resolve) => require(['@/views/RedPacket/details.vue'], resolve),
        meta: {
            title: '红包详情页面'
        }
    },
    {
        path: "/contract",
        component: (resolve) => require(['@/views/News/contract.vue'], resolve),
        meta: {
            title: '协议信息详情'
        }
    },
    {
        path: "/sdkNotice",
        component: (resolve) => require(['@/views/News/SDKNotice.vue'], resolve),
        meta: {
            title: '公告信息'
        }
    },


]

let router = new VueRouter({
    mode: 'history',
    disableDotRule: true,
    routes
})

router.beforeEach((to, from, next) => {
    /* 路由发生变化修改页面title */
    if (to.meta.title) {
        document.title = to.meta.title
    }
    next();
})
export default router;